<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			
			function r1(){
				var searchForm = document.getElementById('searchForm');
				var img = document.getElementById('img1');			
				var check = document.getElementsByName('check');
				for (var i = 0; i < check.length; i++) {
					if(check[i].checked){
						if(check[i].value == 'taobao'){
						img.src = "../imgs/taobao_shopping.png";
						searchForm.action = "https://www.taobao.com";
						}
					else if(check[i].value == 'baidu'){
						img.src = "../imgs/baidu_web.png";
						searchForm.action = "https://www.baidu.com";
						}
					else if(check[i].value == 'google'){
						img.src = "../imgs/google_web.png";
						searchForm.action = "https://www.google.com.hk";
						}
				}
			}
			}
		</script>
	</head>
	<body>
		<div>
			<img src="../imgs/taobao_shopping.png" id="img1" />
			<form action="https://www.taobao.com" id="searchForm">
				<input type="text" />
				<button>搜索</button>
			</form>

			<input type="radio" value="taobao" name="check" checked="checked" onclick="r1()" />淘宝
			<input type="radio" value="baidu" name="check" onclick="r1()" />百度
			<input type="radio" value="google" name="check" onclick="r1()" />火狐
		</div>
	</body>
</html>
